#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
package ${package}.api.model.response;

import com.github.pagehelper.PageInfo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class PaginationResponse<T> implements Serializable {
    // 总记录数
    private long totalCount;
    // 总页数
    private int totalPage;
    // 每页记录数
    private int pageSize;
    // 当前页码
    private int pageIndex;
    // 列表数据
    private List<T> list;

    public PaginationResponse(PageInfo<T> pageInfo) {
        this.totalCount = pageInfo.getTotal();
        this.pageSize = pageInfo.getPageSize();
        this.pageIndex = pageInfo.getPageNum();
        this.totalPage = pageInfo.getPages();
        this.list = pageInfo.getList();
    }
}